package com.example.entity.vo;

public enum State {
    NEW("news"),//新建
    CANCEL("cancel"),//取消
    AUDIT("audit"),//审核
    COMPLETED("completed"),//已完成
    MAKING("making");//预约中

    private final String state;

    State(String val) {
        state = val;
    }

    public String getState() {
        return state;
    }

    public static boolean isState(String state) {
        return state.equals(NEW.getState())
                || state.equals(CANCEL.getState())
                || state.equals(AUDIT.getState())
                || state.equals(MAKING.getState())
                || state.equals(COMPLETED.getState());
    }

    public static State toState(String state) {
        if (state.equals(NEW.getState())) {
            return NEW;
        }
        if (state.equals(CANCEL.getState())) {
            return NEW;
        }
        if (state.equals(AUDIT.getState())) {
            return NEW;
        }
        if (state.equals(MAKING.getState())) {
            return NEW;
        }
        if (state.equals(COMPLETED.getState())) {
            return NEW;
        }
        return null;
    }

}
